import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { router } from './router'
import {
    useAppStore,
    useSiderStore,
    useTagStore,
    useBreadcrumbStore
} from './stores'

import App from './App.vue'

import naive from 'naive-ui'
// 通用字体
import 'vfonts/Lato.css'
// 等宽字体
import 'vfonts/FiraCode.css'

const app = createApp(App)
app.use(createPinia())
app.use(router)
app.use(naive)

const appStore = useAppStore()

const siderSoter = useSiderStore()

const tagStore = useTagStore()

const breadcrumbStore = useBreadcrumbStore()

router.beforeEach((to, from, next) => {
    siderSoter.updateSelect(to)
    tagStore.currentTag(to)
    breadcrumbStore.updateBreadcrumbList(to)
    next()
})

app.mount('#app')
